import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:provider/provider.dart';

import '0demo/main_page.dart';
import '0demo/provider/top_provider/top_provider.dart';
import '0demo/route/page_route_manager.dart';
import '0demo/route/page_stack_manager.dart';
import '0demo/route/routes_name.dart';

// flutter 面试：
// https://github.com/ahyangnb/flutter_interview
void main() {
  // Logger must be init or no use.
  // defaults to Level.INFO
  Logger.root.level = Level.INFO;
  Logger.root.onRecord.listen((record) {
    if (kDebugMode || kProfileMode) {
      debugPrint('${record.level.name}:${record.loggerName}: ${record.message}');
    }
  });
  runApp(MultiProvider(
    providers: [
      ChangeNotifierProvider(create: (_) => TopProvider()),
    ],
    child: MaterialApp(
      home: MainPage(),
      // routes: routePath,
      initialRoute: RoutesName.MAIN_PAGE,
      onGenerateRoute: (RouteSettings settings) {
        return pageRoute(settings);
      },
      navigatorObservers: [navObserver],
    ),
  ));
}
